package com.huan.ddl;

import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HBaseAdmin;

import java.io.IOException;

public class OldTestAPI {

    //1.判断表是否存在

    public static boolean isTableExist() throws IOException {
        String table = "stu";

        //1.获取配置文件信息
        HBaseConfiguration conf = new HBaseConfiguration();
        //配置HBase和zk信息
        conf.set( "hbase.zookeeper.quorum","Bigdata01,Bigdata02,Bigdata03" );


        HBaseAdmin admin = new HBaseAdmin( conf );

        //判断表是否存在
        boolean exists = admin.tableExists( table );

        //关闭连接
        admin.close();

        //返回结果
        return exists;
    }

    public static void main(String[] args) throws IOException {

        boolean exist = isTableExist();
        System.out.println(exist);

    }
}
